#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>

int main()
{
    printf("I am running...\n");
    pid_t id = fork();
    if(id==0)
    {
        //child
        while(1)
        {
            printf("I am child...PID:%d, PPID:%d\n", getpid(), getppid());
            sleep(1);
        }
    }
    else if(id>0)   //father
    {

        int count = 5;
        while(count)
        {
            printf("I am father...PID:%d, PPID:%d\n", getpid(), getppid());
            sleep(1);
            count--;
        }
        printf("father quit\n");
    }
    else{
        //fork error
    }
    return 0;
}
